package com.example.choupaiapp.main.activity;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.example.choupaiapp.R;
import com.example.choupaiapp.common.ui.activity.CommonActivity;
import com.example.choupaiapp.common.util.SharedPreferencesHelp;
import com.example.choupaiapp.common.util.Utils;
import com.example.choupaiapp.main.adapter.ViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by ASUS on 2020/1/6.
 */

public class GuideActivity extends CommonActivity {

    @BindView(R.id.viewpager)
    ViewPager viewpager;
    @BindView(R.id.jump)
    TextView jump;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_guide);
    }

    @Override
    protected void initView() {

        List<View> list = new ArrayList<>();

        LayoutInflater lf = getLayoutInflater().from(this);
        View view1 = lf.inflate(R.layout.guide_one, null);
        View view2 = lf.inflate(R.layout.guide_two, null);
        View view3 = lf.inflate(R.layout.guide_three, null);
        View view4 = lf.inflate(R.layout.guide_four, null);

        list.add(view1);
        list.add(view2);
        list.add(view3);
        list.add(view4);

        viewpager.setAdapter(new ViewPagerAdapter(list));


        jump.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                SharedPreferencesHelp.put("cp_main_guide", true);
                startFinishActivity(MainActivity.class);
            }
        });

    }

    @Override
    protected void initData() {

    }
}
